<template>
    <div class="saying">
        <h2>我是Saying组件</h2>
        <hr/>
        <ul>
            <li v-for="say in saying" :key="say.id">{{say.title}}</li>
        </ul>
        <hr/>
        <h4>学校的年龄是:{{school.age}}</h4>
        <button @click='addSaying'>点击获取数据</button>
    </div>
</template>

<script>
    import {mapState,mapMutations} from 'vuex'
    export default {
        name: 'Saying',
        computed: {
            ...mapState(['school','saying'])       
        },
        methods:{
            addSaying(){
				this.$store.dispatch('addSaying')
			}
        }
    }
</script>

<style scoped>
    .saying{
        background-color: pink;
        padding: 10px;
    }
</style>